package com.kedacom.ctsp.authz.oauth2.client;

import com.kedacom.ctsp.authz.oauth2.client.provider.RequestLoginUrlFilter;
import com.kedacom.ctsp.authz.security.AuthzSecurityProperties;
import com.kedacom.ctsp.authz.security.AuthzWebSecurityConfigurerAdapter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;

/**
 * @author: fenghaiju
 * @Date: Created in 9:29 2018/4/25
 * @Description:
 */
@EnableConfigurationProperties(AuthzSecurityProperties.class)
public class OAuthClientSecurityConfiguration extends AuthzWebSecurityConfigurerAdapter {

    @Autowired
    private RequestLoginUrlFilter requestLoginUrlFilter;

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        super.configure(http);
        http.addFilterBefore(requestLoginUrlFilter, UsernamePasswordAuthenticationFilter.class);
    }
}
